<?php
namespace app\index\controller;

use app\index\logic\EssayCommentLogic;
use app\index\logic\EssayLogic;
use app\index\model\Essay;
use think\Controller;
use think\Db;
use think\Session;
use think\Request;

class Index extends Controller
{
    public function index()
    {
        return $this->fetch('index/index');
    }

    public function share(Request $request){
        $id = $request->param('id');
        $essay_info = EssayLogic::self()->getEssayInfo($id);
        if(!$essay_info){
            $this->error('该信息不存在，请联系管理员');
        }
        $img_count = count($essay_info['img_url']);
        return $this->fetch('index/share',compact('essay_info','img_count'));
    }

}
